$(function(){
	$("#tiku").combobox({
	    url:'../exam/getAllquestionBank',
	    valueField:'qbId',
	    textField:'qbName'
	});
	var url='../exam2/getAllExamScore';
	$('#ExamScore').datagrid({
	    url:url,
	    columns:[[
	    	{field:'',title:'',checkbox:true},
	    	{field:'examPaperId',title:"编号",width:100,align:'center',
	    		formatter: function(value,row,index){
			        return '<a style="color:blue" onClick="shijuan_info('+row+')">'+value+'</a>';
			    }
	    	/*+row.examPaperScore+row.examPaperS+row.examPaperM+row.examPaperJ+row.examPaperF*/
		       
	    	},
			{field:'examPaperName',title:"考卷名",width:100,align:'center'},
			{field:'examPaperScore',title:"总分",width:100,align:'center'},
			{field:'examPaperS',title:"单选分/个",width:100,align:'center'},
			{field:'examPaperSnum',title:"单选数",width:100,align:'center'},
			{field:'examPaperM',title:"多选分/个",width:100,align:'center'},
			{field:'examPaperMnum',title:"多选数",width:100,align:'center'},
			{field:'examPaperJ',title:"判断分/个",width:100,align:'center'},
			{field:'examPaperJnum',title:"判断数",width:100,align:'center'},
			{field:'examPaperF',title:"填空分/个",width:100,align:'center'},
			{field:'examPaperFnum',title:"填空数",width:100,align:'center'},
			{field:'',width:50,align:'center',checkbox:true}
	    ]],
		fit:true,
		method:'get',
		toolbar:'#ExamScore_tb',
		rownumbers:true,
		//显示分页栏
		pagination:true,
		//设置每页大小
		pageSize:3,
		//可选的每页大小
		pageList:[3,6,10],
		
		});
	$("#addTM").bind('click',function(){
		if($("#tiku").val()!=null&&$("#tiku").val()!=""){
			var rows = $('#ExamScore').datagrid('getSelected');
			$.post("../exam2/addTM?qbId="+$("#tiku").val()
					+"&examPaperSnum="+rows.examPaperSnum
					+"&examPaperMnum="+rows.examPaperMnum
					+"&examPaperJnum="+rows.examPaperJnum
					+"&examPaperFnum="+rows.examPaperFnum
					+"&examPaperId="+rows.examPaperId
					,function(){
				alert("添加成功");
				$('#ExamScore').datagrid('reload');
			});
		}else{
			alert("请选择题库");
		}
		
	});
})
function shijuan_info(row){
	alert("试卷")
	$("#tt").tabs('getTab','考试试卷').panel('open').panel('refresh','../exam2/shijuanInfo?row='+row
			/*+examPaperId
			+'&examPaperScore='+examPaperScore+'&examPaperS='+examPaperS
			+'&examPaperM='+examPaperM+'&examPaperJ='+examPaperJ
			+'&examPaperF='+examPaperF*/
	);
	
}